package com.inoneone.youba.mcht.dto;

import com.inoneone.youba.mcht.enums.ErrorCode;
import com.inoneone.toolkit.exception.AssertUtil;

public class PageReq {

    /**
     * 当前页 从1页开始
     */
    private int pageNum;

    /**
     * 每页页数
     */
    private int pageSize;

    /**
     * Description: 参数校验</br>
     * Date: 2017-06-26 12:24:32</br>
     *
     * @param
     * @return
     * @author 姬远玄
     * @since JDK 1.7
    */
    public void validate()
    {
        AssertUtil.isBetween(pageNum, 1, Integer.MAX_VALUE, ErrorCode.PAGE_NO);
        AssertUtil.isBetween(pageSize, 1, 20, ErrorCode.PAGE_SIZE);
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return "PageReq{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                '}';
    }
}
